package hu.dobrosi.dinkycam.j2me.screens;

import hu.dobrosi.dinkycam.gwt.client.StaticUtil;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public class IntroCanvas extends Canvas {
	private Image img;

	public IntroCanvas(Image img) {
		super();
		this.img = img;
		setFullScreenMode(true);
	}

	public void paint(Graphics g) {
		g.setColor(0xFFFFFF);
		g.fillRect(0, 0, getWidth(), getHeight());
		try {
			// Image img = Image.createImage("/logo_m.png");

			int x = (getWidth() - img.getWidth()) / 2;
			int y = (getHeight() - img.getHeight()) / 2;
			g.drawImage(img, x, y, Graphics.LEFT | Graphics.TOP);
		} catch (Exception e) {
			g.setColor(0x008000);
			g.drawString("dinkycam", 0, 0, Graphics.LEFT | Graphics.TOP);
		}
		g.setColor(0x000000);
		g.drawString(StaticUtil.VERSION_MIDLET, getWidth() - 50, getHeight() - 25, Graphics.LEFT | Graphics.TOP);

	}

}